<cfcomponent displayname="users Service" hint="">

	<cffunction name="init" access="public" returntype="usersService" output="false">

		<cfreturn this/>

	</cffunction>

	<cffunction name="setusersGateway" returntype="void" access="public" output="false" hint="dependency: usersGateway">
		<cfargument name="usersGateway" type="usersGateway" required="true"/>
		<cfset variables.m_usersGateway = arguments.usersGateway/>
	</cffunction>

	<cffunction name="setusersDAO" returntype="void" access="public" output="false" hint="dependency: usersDAO">
		<cfargument name="usersDAO" type="usersDAO" required="true"/>
		<cfset variables.m_usersDAO = arguments.usersDAO/>
	</cffunction>

	<cffunction name="getAll" returntype="query" access="public" output="false" hint="I retrieve all existing users">

		<cfreturn variables.m_usersGateway.getAll()/>
	</cffunction>

	<cffunction name="getById" returntype="users" access="public" output="false" hint="I retrieve a users">
		<cfargument name="Id" type="string" required="true"/>
		<cfreturn variables.m_usersDAO.read(arguments.Id)/>
	</cffunction>
	
	<cffunction name="getpasswordSalt" returntype="string" access="public" output="false" hint="I retrieve the password salt for a username.">
		<cfargument name="username" type="string" required="true"/>
		<cfreturn variables.m_usersGateway.getpasswordSalt(arguments.username)/>
	</cffunction>
	
	<cffunction name="Authenticate" returntype="query" access="public" output="false" hint="I Authenticate a user.">
		<cfargument name="username" type="string" required="true"/>
		<cfargument name="password" type="string" required="true"/>
		<cfreturn variables.m_usersGateway.Authenticate(arguments.username,arguments.password)/>
	</cffunction>

	<cffunction name="save" returntype="users" access="public" output="false" hint="I save a users">
		<cfargument name="users" type="users" required="true"/>
		<cfreturn variables.m_usersDAO.save(arguments.users)/>
	</cffunction>

	<cffunction name="remove" returntype="void" access="public" output="false" hint="I remove a users">
		<cfargument name="users" type="users" required="true"/>
		<cfreturn variables.m_usersDAO.delete(arguments.users)/>
	</cffunction>
	
</cfcomponent>